import request from '@/utils/request';
function getPorjectId() {
  let qsArr = window.location.search.slice(1).split('&');
  let project_id = '';
  qsArr.forEach((item) => {
    let [key, value] = item.split('=');
    if (key === 'project_id') {
      project_id = value;
    }
  });
  return project_id;
}
const pid = getPorjectId() || '62104635ca02f53fe5161b48';
// 获取今日用电情况
export function getPowerRate(project_id) {
  return request.get('/SmartDashboard/powerRate?project_id=' + pid);
}

// 获取天气
export function getWeather(project_id) {
  return request.get('/SmartDashboard/weather?project_id=' + pid);
}

// 获取楼宇环境
export function getEnvironment(project_id) {
  return request.get('/SmartDashboard/environment?project_id=' + pid);
}

// 获取照明
export function getLightings(project_id) {
  return request.get('/SmartDashboard/lightings?project_id=' + pid);
}
// 每层用电
export function getBuildingsPower(project_id) {
  return request.get('/SmartDashboard/buildingPower?project_id=' + pid);
}
// 获取用电量区
export function getPowerCompared(project_id) {
  return request.get('/SmartDashboard/powerComparedAll?project_id=' + pid);
}

// 获取空调
export function getAirConditions(project_id) {
  return request.get('/SmartDashboard/airConditions?project_id=' + pid);
}

// 获取通知
export function getNotices(project_id) {
  return request.get('/SmartDashboard/notices?project_id=' + pid);
}

// 获取碳排放
export function getCarbonInfo(project_id) {
  return request.get('/SmartDashboard/carbonInfo?project_id=' + pid);
}

// 获取漏电显示区
export function getElectricMonitors(project_id) {
  return request.get('/SmartDashboard/electricMonitors?project_id=' + pid);
}

// 获取电房评分区
export function getStationGrade(project_id) {
  return request.get('/SmartDashboard/stationGrades?project_id=' + pid);
}

// 左侧显示配置
export function getShowConfigs(project_id) {
  return request.get('/SmartDashboard/showConfigs?project_id=' + pid);
}
